/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pojos;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import newkfp.Bill;
import newkfp.Customer;
import newkfp.Employee;
import newkfp.Exporter;

/**
 *
 * @author A7med Kotb
 */
@Entity
@Table(name = "treausry")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Treausry.findAll", query = "SELECT t FROM Treausry t"),
    @NamedQuery(name = "Treausry.findByTreasuryId", query = "SELECT t FROM Treausry t WHERE t.treasuryId = :treasuryId"),
    @NamedQuery(name = "Treausry.findByActionDate", query = "SELECT t FROM Treausry t WHERE t.actionDate = :actionDate"),
    @NamedQuery(name = "Treausry.findByActionDatePariod", query = "SELECT t FROM Treausry t WHERE t.actionDate between :createDateFrom And :createDateTo"),
    @NamedQuery(name = "Treausry.findByMoneyAmount", query = "SELECT t FROM Treausry t WHERE t.moneyAmount = :moneyAmount")})
public class Treausry implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "treasury_id")
    private Integer treasuryId;
    @Lob
    @Size(max = 65535)
    @Column(name = "general_description")
    private String generalDescription;
    @Column(name = "action_date")
    @Temporal(TemporalType.DATE)
    private Date actionDate;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "money_amount")
    private Double moneyAmount;
    @JoinColumn(name = "customer_id", referencedColumnName = "idCustomer")
    @ManyToOne
    private Customer customerId;
    @JoinColumn(name = "exporter_id", referencedColumnName = "idExporter")
    @ManyToOne
    private Exporter exporterId;
    @JoinColumn(name = "employee_id", referencedColumnName = "idEmployee")
    @ManyToOne
    private Employee employeeId;
    @JoinColumn(name = "bill_id", referencedColumnName = "idBill")
    @ManyToOne
    private Bill billId;

    public Treausry() {
    }

    public Treausry(Integer treasuryId) {
        this.treasuryId = treasuryId;
    }

    public Integer getTreasuryId() {
        return treasuryId;
    }

    public void setTreasuryId(Integer treasuryId) {
        this.treasuryId = treasuryId;
    }

    public String getGeneralDescription() {
        return generalDescription;
    }

    public void setGeneralDescription(String generalDescription) {
        this.generalDescription = generalDescription;
    }

    public Date getActionDate() {
        return actionDate;
    }

    public void setActionDate(Date actionDate) {
        this.actionDate = actionDate;
    }

    public Double getMoneyAmount() {
        return moneyAmount;
    }

    public void setMoneyAmount(Double moneyAmount) {
        this.moneyAmount = moneyAmount;
    }

    public Customer getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Customer customerId) {
        this.customerId = customerId;
    }

    public Exporter getExporterId() {
        return exporterId;
    }

    public void setExporterId(Exporter exporterId) {
        this.exporterId = exporterId;
    }

    public Employee getEmployeeId() {
        return employeeId;
    }

    public void setEmployeeId(Employee employeeId) {
        this.employeeId = employeeId;
    }

    public Bill getBillId() {
        return billId;
    }

    public void setBillId(Bill billId) {
        this.billId = billId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (treasuryId != null ? treasuryId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Treausry)) {
            return false;
        }
        Treausry other = (Treausry) object;
        if ((this.treasuryId == null && other.treasuryId != null) || (this.treasuryId != null && !this.treasuryId.equals(other.treasuryId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pojos.Treausry[ treasuryId=" + treasuryId + " ]";
    }
}
